Class PtmpBuffer

java.lang.Object
com.cisco.pt.impl.PtmpBuffer
All Implemented Interfaces:
EncodedBuffer

public class PtmpBuffer extends Object implements EncodedBuffer
  • Field Details

    • buffer

      protected ByteBuffer buffer
    • isTextMode

      protected boolean isTextMode
  • Constructor Details

    • PtmpBuffer

      public PtmpBuffer(boolean isTextMode)
    • PtmpBuffer

      public PtmpBuffer(int size, boolean isTextMode)
  • Method Details

    • isTextMode

      public boolean isTextMode()
    • dump

      public void dump(String name)
    • copyRawBytes

      public byte[] copyRawBytes(boolean shouldFlip)
      Description copied from interface: EncodedBuffer
      Retrieve the buffer contents as an array of bytes
      Specified by:
      copyRawBytes in interface EncodedBuffer
      Parameters:
      shouldFlip - boolean flag to indicate whether to flip the buffer first
      Returns:
      byte[] contents of buffer
    • getRawBytes

      public byte[] getRawBytes()
      Description copied from interface: EncodedBuffer
      Retrieve the remaining buffer contents as an array of bytes
      Specified by:
      getRawBytes in interface EncodedBuffer
      Returns:
      byte[] contents of buffer from position to limit
    • setRawBytes

      public void setRawBytes(byte[] bytes)
      Description copied from interface: EncodedBuffer
      Set the contents of an EncodedBuffer with an array of bytes
      Specified by:
      setRawBytes in interface EncodedBuffer
      Parameters:
      bytes - array of bytes
    • clear

      public void clear()
      Description copied from interface: EncodedBuffer
      Clear buffer of data
      Specified by:
      clear in interface EncodedBuffer
    • remaining

      public int remaining()
      Description copied from interface: EncodedBuffer
      Get size of remaining buffer data
      Specified by:
      remaining in interface EncodedBuffer
      Returns:
      byte count of remaining data
    • rewind

      public void rewind()
      Description copied from interface: EncodedBuffer
      Rewind buffer to start
      Specified by:
      rewind in interface EncodedBuffer
    • flip

      public void flip()
      Description copied from interface: EncodedBuffer
      Flip buffer to prepare for read or write operation
      Specified by:
      flip in interface EncodedBuffer
    • getBool

      public boolean getBool()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a boolean
      Specified by:
      getBool in interface EncodedBuffer
      Returns:
      boolean value
    • getByte

      public byte getByte()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a byte
      Specified by:
      getByte in interface EncodedBuffer
      Returns:
      byte value
    • getByteRaw

      public byte getByteRaw()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a raw byte, even in a text buffer
      Specified by:
      getByteRaw in interface EncodedBuffer
      Returns:
      byte value
    • getChar

      public char getChar()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a char
      Specified by:
      getChar in interface EncodedBuffer
      Returns:
      char value
    • getDouble

      public double getDouble()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a double
      Specified by:
      getDouble in interface EncodedBuffer
      Returns:
      double value
    • getFloat

      public float getFloat()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a float
      Specified by:
      getFloat in interface EncodedBuffer
      Returns:
      float value
    • getInt

      public int getInt()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as an integer
      Specified by:
      getInt in interface EncodedBuffer
      Returns:
      int value
    • getIPAddress

      public IPAddress getIPAddress()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a IPAddress
      Specified by:
      getIPAddress in interface EncodedBuffer
      Returns:
      IPAddress value
    • getIPV6Address

      public IPV6Address getIPV6Address()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a IPV6Address
      Specified by:
      getIPV6Address in interface EncodedBuffer
      Returns:
      IPV6Address value
    • getLong

      public long getLong()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a long
      Specified by:
      getLong in interface EncodedBuffer
      Returns:
      long value
    • getMACAddress

      public MACAddress getMACAddress()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a MACAddress
      Specified by:
      getMACAddress in interface EncodedBuffer
      Returns:
      MACAddress value
    • getShort

      public short getShort()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a short
      Specified by:
      getShort in interface EncodedBuffer
      Returns:
      short value
    • getString

      public String getString()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a String
      Specified by:
      getString in interface EncodedBuffer
      Returns:
      String value
    • peekString

      public String peekString()
      Description copied from interface: EncodedBuffer
      Looks at the next buffer without advancing
      Specified by:
      peekString in interface EncodedBuffer
      Returns:
      String value
    • getUUID

      public UUID getUUID()
      Description copied from interface: EncodedBuffer
      Retrieve the next buffer entry as a UUID
      Specified by:
      getUUID in interface EncodedBuffer
      Returns:
      UUID value
    • putBool

      public EncodedBuffer putBool(boolean b)
      Description copied from interface: EncodedBuffer
      Store a boolean value to the encoded buffer
      Specified by:
      putBool in interface EncodedBuffer
      Parameters:
      b - boolean value
      Returns:
      EncodedBuffer object
    • putByte

      public EncodedBuffer putByte(byte b)
      Description copied from interface: EncodedBuffer
      Store a byte value to the encoded buffer
      Specified by:
      putByte in interface EncodedBuffer
      Parameters:
      b - byte value
      Returns:
      EncodedBuffer object
    • putByteList

      public EncodedBuffer putByteList(List<Byte> byteList)
      Description copied from interface: EncodedBuffer
      Store a byte list value to the encoded buffer
      Specified by:
      putByteList in interface EncodedBuffer
      Parameters:
      byteList - byte list value
      Returns:
      EncodedBuffer object
    • putChar

      public EncodedBuffer putChar(char c)
      Description copied from interface: EncodedBuffer
      Store a char value to the encoded buffer
      Specified by:
      putChar in interface EncodedBuffer
      Parameters:
      c - char value
      Returns:
      EncodedBuffer object
    • putDouble

      public EncodedBuffer putDouble(double d)
      Description copied from interface: EncodedBuffer
      Store a double value to the encoded buffer
      Specified by:
      putDouble in interface EncodedBuffer
      Parameters:
      d - double value
      Returns:
      EncodedBuffer object
    • putFloat

      public EncodedBuffer putFloat(float f)
      Description copied from interface: EncodedBuffer
      Store a float value to the encoded buffer
      Specified by:
      putFloat in interface EncodedBuffer
      Parameters:
      f - float value
      Returns:
      EncodedBuffer object
    • putInt

      public EncodedBuffer putInt(int i)
      Description copied from interface: EncodedBuffer
      Store an int value to the encoded buffer
      Specified by:
      putInt in interface EncodedBuffer
      Parameters:
      i - int value
      Returns:
      EncodedBuffer object
    • putIPAddress

      public EncodedBuffer putIPAddress(IPAddress i)
      Description copied from interface: EncodedBuffer
      Store an IPAddress value to the encoded buffer
      Specified by:
      putIPAddress in interface EncodedBuffer
      Parameters:
      i - IPAddress value
      Returns:
      EncodedBuffer object
    • putIPV6Address

      public EncodedBuffer putIPV6Address(IPV6Address i)
      Description copied from interface: EncodedBuffer
      Store an IPV6Address value to the encoded buffer
      Specified by:
      putIPV6Address in interface EncodedBuffer
      Parameters:
      i - IPV6Address value
      Returns:
      EncodedBuffer object
    • putLong

      public EncodedBuffer putLong(long l)
      Description copied from interface: EncodedBuffer
      Store a long value to the encoded buffer
      Specified by:
      putLong in interface EncodedBuffer
      Parameters:
      l - long value
      Returns:
      EncodedBuffer object
    • putMACAddress

      public EncodedBuffer putMACAddress(MACAddress m)
      Description copied from interface: EncodedBuffer
      Store a MACAddress value to the encoded buffer
      Specified by:
      putMACAddress in interface EncodedBuffer
      Parameters:
      m - MACAddress value
      Returns:
      EncodedBuffer object
    • putShort

      public EncodedBuffer putShort(short s)
      Description copied from interface: EncodedBuffer
      Store a short value to the encoded buffer
      Specified by:
      putShort in interface EncodedBuffer
      Parameters:
      s - short value
      Returns:
      EncodedBuffer object
    • putString

      public EncodedBuffer putString(String s)
      Description copied from interface: EncodedBuffer
      Store a String value to the encoded buffer
      Specified by:
      putString in interface EncodedBuffer
      Parameters:
      s - String value
      Returns:
      EncodedBuffer object
    • putStringAsBytes

      public EncodedBuffer putStringAsBytes(byte[] bytes)
      Description copied from interface: EncodedBuffer
      Store a String value to the encoded buffer as a byte array
      Specified by:
      putStringAsBytes in interface EncodedBuffer
      Parameters:
      bytes - byte array value
      Returns:
      EncodedBuffer object
    • putUUID

      public EncodedBuffer putUUID(UUID u)
      Description copied from interface: EncodedBuffer
      Store a UUID value to the encoded buffer
      Specified by:
      putUUID in interface EncodedBuffer
      Parameters:
      u - UUID value
      Returns:
      EncodedBuffer object
    • nextString

      protected String nextString()
    • peekNextString

      protected String peekNextString()
    • asBool

      protected boolean asBool(String s)
    • asByte

      protected byte asByte(String s)
    • asChar

      protected char asChar(String s)
    • asDouble

      protected double asDouble(String s)
    • asFloat

      protected float asFloat(String s)
    • asInt

      protected int asInt(String s)
    • asIPAddress

      protected IPAddress asIPAddress(String s)
    • asIPV6Address

      protected IPV6Address asIPV6Address(String s)
    • asLong

      protected long asLong(String s)
    • asMACAddress

      protected MACAddress asMACAddress(String s)
    • asShort

      protected short asShort(String s)
    • asUUID

      protected UUID asUUID(String s)
    • asString

      protected String asString(boolean b)
    • asString

      protected String asString(byte b)
    • asString

      protected String asString(byte[] bytes)
    • asString

      protected String asString(char c)
    • asString

      protected String asString(double d)
    • asString

      protected String asString(float f)
    • asString

      protected String asString(int i)
    • asString

      protected String asString(IPAddress ip)
    • asString

      protected String asString(IPV6Address ip)
    • asString

      protected String asString(long l)
    • asString

      protected String asString(MACAddress mac)
    • asString

      protected String asString(short s)
    • asString

      protected String asString(UUID uuid)